package com.mt.roll.core.dal.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 短信验证码表，过期时间和使用状态可以不用
 * </p>
 *
 * @author mt
 * @since 2021-12-30
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("t_sms_code")
public class SmsCode extends Model<SmsCode> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键，自增
     */
      @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 手机号码
     */
    @TableField("mobile")
    private String mobile;

    /**
     * 验证码
     */
    @TableField("code")
    private String code;

    /**
     * 1、注册	            2、找回密码	            3、动态密码
     */
    @TableField("type")
    private Integer type;

    /**
     * 过期时间
     */
    @TableField("expires_time")
    private LocalDateTime expiresTime;

    /**
     * 使用状态：0、未使用，1、已使用
     */
    @TableField("used_status")
    private Integer usedStatus;

    /**
     * 备注
     */
    @TableField("remark")
    private String remark;

    /**
     * 删除标志，是否有效:1 可用 0不可用
     */
    @TableField("valid")
    @TableLogic
    private Integer valid;

    /**
     * 创建人
     */
    @TableField("creator")
    private Long creator;

    /**
     * 创建人姓名
     */
    @TableField("creator_name")
    private String creatorName;

    /**
     * 创建时间
     */
    @TableField("create_time")
    private LocalDateTime createTime;

    /**
     * 更新人
     */
    @TableField("updater")
    private Long updater;

    /**
     * 更新人姓名
     */
    @TableField("updater_name")
    private String updaterName;

    /**
     * 更新时间
     */
    @TableField("update_time")
    private LocalDateTime updateTime;

    /**
     * 版本号
     */
    @TableField("version")
    @Version
    private Integer version;


    public static final String ID = "id";

    public static final String MOBILE = "mobile";

    public static final String CODE = "code";

    public static final String TYPE = "type";

    public static final String EXPIRES_TIME = "expires_time";

    public static final String USED_STATUS = "used_status";

    public static final String REMARK = "remark";

    public static final String VALID = "valid";

    public static final String CREATOR = "creator";

    public static final String CREATOR_NAME = "creator_name";

    public static final String CREATE_TIME = "create_time";

    public static final String UPDATER = "updater";

    public static final String UPDATER_NAME = "updater_name";

    public static final String UPDATE_TIME = "update_time";

    public static final String VERSION = "version";

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
